﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;

namespace WpfApp1
{
    public class Node
    {
        public static Node RootNode { get; set; } = new Node() { Name = "Root", Path = "" };
        public string Name { get; set; }
        public string Path { get; set; }
        public string Tag { get; set; }
        public List<Node> Children { get; set; }

        private Node()
        { }

        public Node(Code code)
        {
            Children = new List<Node>();
            Path = code.关键字;
            Tag = code.代码文本;
        }
    }

    internal class 数据绑定类 : INotifyPropertyChanged
    {
        private ObservableCollection<Code> _codes;

        public ObservableCollection<Code> codes
        {
            get => _codes;
            set
            {
                _codes = value;
                OnPropertyChanged(nameof(codes));
            }
        }

        public 数据绑定类()
        {
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}